<?php

namespace Authentication\View\Helper;

use Zend\Authentication\AuthenticationService;

class AuthViewHelper extends \Zend\View\Helper\AbstractHelper {
    /**
     * @var AuthenticationService
     */
    protected $authService;
    
    public function __invoke() {
        return $this;     // TODO: CLEANUP!
    }
    
    public function hasIdentity() {
        return $this->getAuthService()->hasIdentity();
    }
    
    public function getIdentity() {
       $user = $this->getAuthService()->getIdentity();
       return $user; 
    }
    
    
    /**
     * Get authService.
     *
     * @return AuthenticationService
     */
    public function getAuthService()
    {
        return $this->authService;
    }

    /**
     * Set authService.
     *
     * @param AuthenticationService $authService
     * @return AuthViewHelper
     */
    public function setAuthService(AuthenticationService $authService)
    {
        $this->authService = $authService;
        return $this;
    }
}